﻿@using Orchard.DynamicForms.Elements
@using Orchard.Layouts.Helpers
@{
    var element = (TextArea)Model.Element;
    var tagBuilder = TagBuilderExtensions.CreateElementTagBuilder(Model, "textarea");

    tagBuilder.AddCssClass("text design");
    tagBuilder.Attributes["name"] = element.Name;

    if (element.Rows != null) {
        tagBuilder.Attributes["rows"] = element.Rows.ToString();
    }

    if (element.Columns != null) {
        tagBuilder.Attributes["cols"] = element.Columns.ToString();
    }

    tagBuilder.SetInnerText(element.Value);
}

@if (element.ShowLabel) {
    <div>
        <label for="@element.HtmlId">@element.Label</label>
        @tagBuilder.ToHtmlString(TagRenderMode.Normal)
    </div>
}
else {
    @tagBuilder.ToHtmlString(TagRenderMode.Normal)
}